Skip to content

Harden enum-value-formatting meta:enum handling#821

Merged
stevespringett merged 1 commit intoCycloneDX:2.0-devfrom
Mehrn0ush:fix/linter-meta-enum-policy
Feb 19, 2026
Merged

Harden enum-value-formatting meta:enum handling#821
stevespringett merged 1 commit intoCycloneDX:2.0-devfrom
Mehrn0ush:fix/linter-meta-enum-policy

Conversation

@Mehrn0ush
Copy link
Contributor

Harden enum-value-formatting check

Fixes #820

Summary

Harden meta:enum handling to be deterministic and safe: use own-property checks, require meta:enum to be a plain object (emit explicit error when invalid), fix coverage to check key presence (not truthiness), improve meta:enum paths, and de-duplicate enum value issues. No API/config changes.

Changes

  • Detect meta:enum via Object.prototype.hasOwnProperty.call(parent, 'meta:enum') (no prototype-chain lookup).
  • Validate meta:enum is a plain object; emit one ERROR when invalid type.
  • Coverage: use own-key presence (hasOwnProperty) on meta:enum (no truthiness false-positives, no inherited keys).
  • Report “missing description” at the meta:enum path; fix extra-keys path derivation.
  • Iterate over unique enum string values to avoid duplicate issues.

Use own-property checks and require meta:enum to be a plain object.
Fix coverage check to test key presence, improve meta:enum paths,
and de-duplicate enum value issues. Fixes CycloneDX#820.

Signed-off-by: Mehrn0ush <mehrnoush.vaseghi@gmail.com>
@Mehrn0ush Mehrn0ush requested a review from a team as a code owner February 14, 2026 14:06
@stevespringett stevespringett merged commit 5b0d747 into CycloneDX:2.0-dev Feb 19, 2026
9 checks passed
@stevespringett stevespringett added test-data related to test-resources and -data labels Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test-data related to test-resources and -data

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants